package com.ecar.api.service.manager.impl;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ecar.api.service.manager.LogOpsService;
import com.ecar.common.dto.DataBean;
import com.ecar.common.dto.Pager;
import com.ecar.core.manager.dao.LogOpsMapper;
import com.ecar.core.manager.entity.LogOps;

@Service
@Transactional
public class LogOpsServiceImpl  implements LogOpsService{
	
	@Autowired
	LogOpsMapper logOpsMapper;
	
	@Override
	public DataBean getByPager(Pager pager) {
		List<LogOps> list = logOpsMapper.queryByPager(pager);
		return new DataBean(200, list, "查询成功!");
	}

	/*@Autowired
	private StaffDao staffDao;

	@Override
	public void insertStaffOpsLog(HttpServletRequest request, String ops, String opsParameter) {
		try {
			String ip = request.getParameter("ip");
			String module = request.getParameter("module");
			String browser = request.getParameter("browser");
			int staffId = Integer.parseInt(request.getParameter("loginUser"));

			Staff staff = staffDao.get(staffId);
			if (staff == null) throw new MyException("未找到操作用户。");

			LogOps logOps = new LogOps();
			logOps.setIp(ip);
			logOps.setBrowser(browser);
			logOps.setModuleMenu(module);
			logOps.setOps(ops);
			logOps.setOpsParament(opsParameter);
			logOps.setStaff(staff);
			logOps.setUsername(staff.getUsername());
			logOps.setOpsTime(new Date());
			baseDao.save(logOps);
		} catch (Exception e) {
			log.debug("记录操作日志失败。");
			e.printStackTrace();
		}*/
	}
